package net.xiduth.game.player.actions;

import net.xiduth.game.Animation;
import net.xiduth.game.Graphics;
import net.xiduth.game.player.Player;
import net.xiduth.utils.Utils;

public class Dreaming extends Action {

	@Override
	public boolean start(Player player) {
		if (!process(player))
			return false;
		player.setNextAnimation(new Animation(6295));
		return true;
	}

	@Override
	public boolean process(Player player) {
		if (player.getPoison().isPoisoned()) {
			player.getPackets().sendGameMessage(
					"You can't dream while you're poisoned.");
			return false;
		}
		if (player.getAttackedByDelay() + 10000 > Utils.currentTimeMillis()) {
			player.getPackets().sendGameMessage(
					"You can't dream until 10 seconds after the end of combat.");
			return false;
		}
		player.setNextAnimation(new Animation(6296));
		player.setNextGraphics(new Graphics(277, 0, 80));
		return true;
	}

	@Override
	public int processWithDelay(Player player) {
		return 0;
	}

	@Override
	public void stop(Player player) {
		player.setNextAnimation(new Animation(6297));
		player.getEmotesManager().setNextEmoteEnd();
	}

}